/*
 *  Copyright (C) 2011  Clint Priest
 *
 *  This file is part of pklib.
 *
 *  pklib is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  pklib is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with pklib.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Portions borrowed or re-written from prototype
 */

/* Object Reference */
var or = Object;

or.extend = function(dest, src) {
	for(var prop in src)
		dest[prop] = src[prop];
	return dest;
}

Object.extend(Object, (function() {
	var _toString = Object.prototype.toString;

	function isArray(object) {
		return _toString.call(object) == "[object Array]";
	}

	function isFunction(object) {
		return typeof object === 'function';
	}

	function isString(object) {
		return _toString.call(object) == '[object String]';
	}

	function isNumber(object) {
		return _toString.call(object) == '[object Number]';
	}
	
	function values(object) {
		return Object.keys(object).reduce( function(out, key) {
			out.push(object[key]);
			return out;
		}, [ ] );
	}

	return {
		isFunction: isFunction,
		isString: 	isString,
		isNumber:	isNumber,
		isArray: 	isArray,
		values:		values,
	}
})());
